﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace DoAn
{
    public class Building : Object
    {
        public Building()
        {
            mySprites = new List<MySprite>();
            nSprites = 0;
        }

        virtual public void newBuilding(Vector2 pos, Object init)
        {
            //CheckCell(pos);
            //MySprite temp = new MySprite(SpriteModel);
            ////temp.Blood = Maxblood;
            //temp.Position = Game1.center(pos) - new Vector2(Game1.CellWidth / 2, Game1.CellHeight / 2);
            //mySprites.Add(temp);
            //nSprites++;
            //init.mySprites.Add(temp);
            //init.nSprites++;
        }
        //public void CheckCell(Vector2 pos)
        //{
        //    Vector2 v = Game1.LocalCell(pos);
        //    //Game1.b[]
        //}

        public void CreateHero(Army army, MySprite sprite)
        {
            if(sprite.Life)
                army.newArmy(Game1.init, sprite);
        }

        //public void newBuilding(Vector2 pos, Object init)
        //{
        //    //Position = Game1.center(pos) - new Vector2(Game1.CellWidth / 2, Game1.CellHeight / 2);
        //    CheckCell(ref pos);
        //    MySprite temp = new MySprite(SpriteModel);
        //    //temp.Blood = Maxblood;
        //    temp.Position = Game1.center(pos) - new Vector2(Game1.CellWidth / 2, Game1.CellHeight / 2);
        //    temp.Target = temp.PosCenter;
        //    mySprites.Add(temp);
        //    nSprites++;
        //    init.mySprites.Add(temp);
        //    init.nSprites++;
        //}

        //static public void CheckCell(ref Vector2 pos)
        //{
        //    Vector2 v = Game1.LocalCell(pos);
        //    int x, y;
        //    for (int i = 0; i < 3; i++)
        //    {
        //        for (int j = 0; j < 3; j++)
        //        {
        //            x = (int)v.X + j;
        //            y = (int)v.Y + i;
        //            if (x >= 0 && x < Game1.nCols && y >= 0 && y < Game1.nRows)
        //                Game1.b[y, x] = true;
        //        }
        //    }
        //}
        //static public void UnCheckCell(ref Vector2 pos)
        //{
        //    Vector2 v = Game1.LocalCell(pos);
        //    int x, y;
        //    for (int i = 0; i < 3; i++)
        //    {
        //        for (int j = 0; j < 3; j++)
        //        {
        //            x = (int)v.X + j;
        //            y = (int)v.Y + i;
        //            if (x >= 0 && x < Game1.nCols && y >= 0 && y < Game1.nRows)
        //                Game1.b[y, x] = false;
        //        }
        //    }
        //}
    }
}
